package org.example.DesignPatterns.Composite;

/**
 * @description:
 * @author: farprt
 * @create: 2022-09-18 13:10
 **/
public abstract class Node {

    protected String name;

    public Node(String name){
        this.name=name;
    }

    protected abstract void add(Node child) throws Exception;

    protected void tree(int space){
        for(int i=0;i<space;i++){
            System.out.print(" ");
        }
        System.out.println(name);
    }

    protected void tree(){
        tree(0);
    }

}